<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    function Fn(m){
        this.message = m;
    }
    Fn.prototype.show = function(){
        console.log(this.message);
    }
    var f1 = new Fn("消息1");
    var f2 = new Fn("消息2");
    f1.show();
    f2.show();
    console.log(f1);
    console.log(f2);
    console.log(f1 === f2);
    console.log(f1.show === f2.show);

    console.log("----------------")

    class Fun{
        constructor(m){
            // 等同于构造函数部分：属性
            this.message = m;
        }
        // 等同于构造函数的原型部分：方法
        show(){
            console.log(this.message);
        }
    }
    var f1 = new Fun("消息1");
    var f2 = new Fun("消息2");
    f1.show();
    f2.show();
    console.log(f1);
    console.log(f2);
    console.log(f1 === f2);
    console.log(f1.show === f2.show);
    


</script>
</html>